package com.ling.sbbyyds.mapper.community;

import com.ling.sbbyyds.entity.community.CommunityPostsLike;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;


/**
 * 帖子点赞表(CommunityPostLike)表数据库访问层
 *
 * @author ling
 * @since 2022-08-13 17:47:56
 */
@Repository
public interface CommunityPostLikeMapper extends Mapper<CommunityPostsLike> {

    /**
     * 用户是否点赞帖子
     *
     * @param userId 用户id
     * @param postId 帖子id
     * @return
     */
    @Select("SELECT COUNT(user_id) FROM sbb_community_posts_like WHERE user_id = #{userId} AND post_id = #{postId} ")
    Integer userIsLikePost(Long userId, Long postId);

}

